package org.ds.biz.user;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

@Entity
@Table(name = "entity_contact_information")
public class ContactInformation
{
	@Column(name = "email_address")
	private String emailAddress = null;

	@Column(name = "home_phone")
	private String homePhone = null;

	@Column(name = "work_phone")
	private String workPhone = null;

	@Column(name = "cell_phone")
	private String cellPhone = null;
	
	@Id
	@GeneratedValue(generator = "foreign")
	@GenericGenerator(name = "foreign", strategy = "foreign", parameters = { @Parameter(value = "customer", name = "property") })
	@Column(name = "customer_id")
	// this is the id of the customer - as the contact information is always
	// associated with a customer (cannot exist independent of a customer)
	private Long customerID = null;
	
	@OneToOne
	@JoinColumn(name = "customer_id")
	// reference to the customer object. hibernate requires two-way object references
	// even though we are modeling a one-to-one relationship.
	private Customer customer = null;

	public ContactInformation()
	{
	}

	public String getEmailAddress()
	{
		return emailAddress;
	}

	public void setEmailAddress(String emailAddress)
	{
		this.emailAddress = emailAddress;
	}

	public String getHomePhone()
	{
		return homePhone;
	}

	public void setHomePhone(String homePhone)
	{
		this.homePhone = homePhone;
	}

	public String getWorkPhone()
	{
		return workPhone;
	}

	public void setWorkPhone(String workPhone)
	{
		this.workPhone = workPhone;
	}

	public String getCellPhone()
	{
		return cellPhone;
	}

	public void setCellPhone(String cellPhone)
	{
		this.cellPhone = cellPhone;
	}
	
	protected void setCustomerID(Long id)
	{
		customerID = id;
	}

	protected Long getCustomerID()
	{
		return customerID;
	}

	protected void setCustomer(Customer customer)
	{
		this.customer = customer;
	}

	protected Customer getCustomer()
	{
		return customer;
	}

}
